package com.ferry.wallpaper.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ferry.wallpaper.mapper.UserWallMapper;
import com.ferry.wallpaper.domain.UserWall;
import com.ferry.wallpaper.service.UserWallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserWallServiceImpl implements UserWallService {


    @Autowired
    private UserWallMapper userWallMapper;

    @Override
    public List<UserWall> get(Long userId) {
        QueryWrapper<UserWall> wrapper = new QueryWrapper<UserWall>().eq("USER_ID",userId);
        return userWallMapper.selectList(wrapper);
    }

    @Override
    public int getDownloadNumber(Long wallId) {
        QueryWrapper<UserWall> wrapper = new QueryWrapper<UserWall>().eq("WALL_ID",wallId);
        return userWallMapper.selectCount(wrapper);
    }
}
